//
//  NoticationViewController.m
//  CNKICommunity
//
//  Created by wei on 17/3/7.
//  Copyright © 2017年 CNKI. All rights reserved.
//

#import "NoticationViewController.h"
#import "CNKIProfessionalModel.h"
@interface NoticationViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView *MainTableView;

@property(nonatomic,strong)NSMutableArray *dataArr;


@end

@implementation NoticationViewController

-(NSMutableArray *)dataArr
{
    if (!_dataArr)
    {
        _dataArr = [NSMutableArray array];
    }
    return _dataArr;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    NSArray *names = @[@"西门电工", @"西门厨师", @"西门抽风", @"西门吹雪", @"东门电工", @"东门抽筋", @"东门抽风", @"东门吹雪", @"北门厨师", @"北门抽筋", @"南门抽风", @"南门吹雪"];
    for (int i = 0; i<20; i++) {
        CNKIProfessionalModel *p = [[CNKIProfessionalModel alloc] init];
        p.ProfessionalName = [NSString stringWithFormat:@"%@-%d", names[arc4random_uniform(names.count)], arc4random_uniform(100)];
        [self.dataArr addObject:p];
    }
    

    [self setUpTableView];
}
-(void)setUpTableView
{
    _MainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT) style:UITableViewStylePlain];
    _MainTableView.delegate = self;
    _MainTableView.dataSource = self;
    [self.view addSubview:_MainTableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Mycell"];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Mycell"];
    }
    CNKIProfessionalModel *model = self.dataArr[indexPath.row];
    cell.textLabel.text = model.ProfessionalName;
    return cell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
